import React, { Component } from 'react';

class App extends Component {
  state={
    checked:true,
    selected:'Tom'
  }
  /* 改变单选框的状态 */
  handleBoxChange = (e)=>{
    this.setState({
      checked:e.target.checked
    })
  }
  /* 改变下拉表单的值 */
  handleSelChange = (e)=>{
    this.setState({
      selected:e.target.value,
    })
  }
  render() {
    return (
      <div>
        <input type="checkbox" 
        checked={this.state.checked}
        onChange={this.handleBoxChange}
        />
        <select name="" id="" 
        value={this.state.selected}
        onChange={this.handleSelChange}>
          <option value="Tom">Tom</option>
          <option value="Jerry">Jerry</option>
          <option value="Tom&jerry">Tom & Jerry</option>
        </select>
      </div>
    );
  }
}

export default App;
